from fastapi import FastAPI

def register_event(app: FastAPI) -> None:
    """
        注册系统启动和退出事件
    """
    def startup(app):

        async def app_start():
            print("系统启动成功")

        return app_start

    def shutdown(app):

        async def app_stop():
            print("系统已结束")

        return app_stop
    
    app.add_event_handler("startup", startup(app))
    app.add_event_handler("shutdown", shutdown(app))
